<html>
<head><meta charset="utf-8"><title>const_evaluatable_checked bound repetition · project-const-generics · Zulip Chat Archive</title></head>
<h2>Stream: <a href="https://rust-lang.github.io/zulip_archive/stream/260443-project-const-generics/index.html">project-const-generics</a></h2>
<h3>Topic: <a href="https://rust-lang.github.io/zulip_archive/stream/260443-project-const-generics/topic/const_evaluatable_checked.20bound.20repetition.html">const_evaluatable_checked bound repetition</a></h3>

<hr>

<base href="https://rust-lang.zulipchat.com">

<head><link href="https://rust-lang.github.io/zulip_archive/style.css" rel="stylesheet"></head>

<a name="215973827"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/260443-project-const-generics/topic/const_evaluatable_checked%20bound%20repetition/near/215973827" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Thom Chiovoloni <a href="https://rust-lang.github.io/zulip_archive/stream/260443-project-const-generics/topic/const_evaluatable_checked.20bound.20repetition.html#215973827">(Nov 07 2020 at 21:14)</a>:</h4>
<p>I tried out <code>const_evaluatable_checked</code> — it's very cool (and worked better than I thought), but I have a question about the design:</p>
<p>Is there an intention that eventually the bounds it requires for expressions to be inferred eventually? I don't mind it so much in the module defining the type (although it gets very tedious on every impl block), but code using the type have to repeat the exact bound (if it instantiates using const generics), which feels like a abstraction leak a little (especially when a tweak to that expression requires many updates to usage codes bounds...)</p>
<p>I know I can write a const fn to alleviate this, I'm more asking: is this deliberate — or am I just cutting myself on a bleeding edge?</p>



<a name="215978124"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/260443-project-const-generics/topic/const_evaluatable_checked%20bound%20repetition/near/215978124" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> lcnr <a href="https://rust-lang.github.io/zulip_archive/stream/260443-project-const-generics/topic/const_evaluatable_checked.20bound.20repetition.html#215978124">(Nov 07 2020 at 23:14)</a>:</h4>
<p>do you have a concrete example of what you mean here?</p>



<a name="216002801"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/260443-project-const-generics/topic/const_evaluatable_checked%20bound%20repetition/near/216002801" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> jplatte <a href="https://rust-lang.github.io/zulip_archive/stream/260443-project-const-generics/topic/const_evaluatable_checked.20bound.20repetition.html#216002801">(Nov 08 2020 at 11:31)</a>:</h4>
<p><span class="user-mention" data-user-id="209168">@Thom Chiovoloni</span> I think this is deliberate: Technically any such change is a breaking change and you generally want that to be obvious. If you forsee the bound changing often, definitely abstract it into a <code>const fn</code>.</p>



<a name="216124587"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/260443-project-const-generics/topic/const_evaluatable_checked%20bound%20repetition/near/216124587" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Thom Chiovoloni <a href="https://rust-lang.github.io/zulip_archive/stream/260443-project-const-generics/topic/const_evaluatable_checked.20bound.20repetition.html#216124587">(Nov 09 2020 at 18:25)</a>:</h4>
<p>I get that, but it means making apis with it is fragile in a way almost nothing else in rust is. It defaults to all the implementation details being important.</p>



<a name="216125943"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/260443-project-const-generics/topic/const_evaluatable_checked%20bound%20repetition/near/216125943" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> jplatte <a href="https://rust-lang.github.io/zulip_archive/stream/260443-project-const-generics/topic/const_evaluatable_checked.20bound.20repetition.html#216125943">(Nov 09 2020 at 18:36)</a>:</h4>
<p>This has been discussed at length in <a href="https://github.com/rust-lang/rust/issues/68436">https://github.com/rust-lang/rust/issues/68436</a>. My takeaway is that there's just not going to be implicit bounds, for good reasons. Maybe there will be some inference for them, but only in the kind of ways that are also being explored / worked on for type generics.</p>



<a name="216142726"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/260443-project-const-generics/topic/const_evaluatable_checked%20bound%20repetition/near/216142726" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> lcnr <a href="https://rust-lang.github.io/zulip_archive/stream/260443-project-const-generics/topic/const_evaluatable_checked.20bound.20repetition.html#216142726">(Nov 09 2020 at 21:04)</a>:</h4>
<blockquote>
<p>I get that, but it means making apis with it is fragile in a way almost nothing else in rust is. It defaults to all the implementation details being important.</p>
</blockquote>
<p>can you please add an example?</p>



<hr><p>Last updated: Aug 07 2021 at 22:04 UTC</p>
</html>